package com.test.objects;

import java.util.Date;

public class Post implements Comparable<Post> {
	private int id = 0;
	private Category category;
	private String title;
	private Author author;
	private Date dateTime = new Date();
	private String summary;
	private String imageUrl;
	private String content;
	
	public Post(){
		this.setTitle("");
		this.setAuthor(new Author());
		this.setSummary("");
		this.setContent("");
	}
	
	public Post(String title, Author author, Date date, 
				String _abstract, String content){
		this.setTitle(title);
		this.setAuthor(author);
		this.setDateTime(date);
		this.setSummary(_abstract);
		this.setContent(content);
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category cat) {
		this.category = cat;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Author getAuthor() {
		return this.author;
	}

	public void setAuthor(Author author) {
		this.author = author;
	}

	public Date getDateTime() {
		return dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int compareTo(Post o) {
		int res = o.getDateTime().compareTo(this.dateTime);
		if (res == 0) res = 1;
		return res;
	}

}
